package com.xwzn.resident.fragment;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.xwzn.resident.LoginActivity;
import com.xwzn.resident.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
 * @Description:事件上报
 * @Author: XuQiHao
 * @CreateDate: 2019/12/23 11:26
 * @Version: 1.0
 */
public class TwoFragment extends Fragment {
    private View view;
    @BindView(R.id.ll_Event)
    LinearLayout ll_Event;
    @BindView(R.id.ll_Record)
    LinearLayout ll_Record;
    Intent intent;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
       //填充布局
        view = inflater.inflate(R.layout.fragment_dashboard, container, false);
        //绑定ButterKnife
        ButterKnife.bind(this, view);
        return view;
    }

    @OnClick({R.id.ll_Event, R.id.ll_Record})
    void abc(View view) {
        switch (view.getId()) {
            //事件上报
            case R.id.ll_Event:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {
                    if (false) {
                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
                //上报记录
            case R.id.ll_Record:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {
                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
        }
    }

}
